﻿using FigureDraw.Diagram;
using FigureDraw.Graphic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FigureDraw.Shapes.ActivityShape
{
    class MoveActivity : MyShape
    {
        double x2;
        double y2;

        public MoveActivity(double x1, double y1, double x2, double y2)
            : base(x1, y1)
        {
            this.x2 = x2;
            this.y2 = y2;
        }

        public override void Draw(CommonGraphic graphic)
        {
            double arrowDegrees = 0.5;
            double arrowLength = 15;

            double angle = Math.Atan2(y2 - y, x2 - x) + Math.PI;

            double arrowX1 = x2 + arrowLength * Math.Cos(angle - arrowDegrees);
            double arrowY1 = y2 + arrowLength * Math.Sin(angle - arrowDegrees);
            double arrowX2 = x2 + arrowLength * Math.Cos(angle + arrowDegrees);
            double arrowY2 = y2 + arrowLength * Math.Sin(angle + arrowDegrees);

            graphic.DrawLine(x, y, x2, y2);
            graphic.DrawLine(arrowX1, arrowY1, x2, y2);
            graphic.DrawLine(arrowX2, arrowY2, x2, y2);
        }

        public override MyShape Clone(BlockDiagram diagram)
        {
            throw new NotImplementedException();
        }
    }
}
